<template>
    <el-container>
        <el-container style="height: 520px">
            <el-header>
                <el-form
                    inline
                    label-width="49px"
                    :model="queryList"
                    style="margin-top: 5px; width: 100%"
                >
                    <el-input
                        placeholder="---请输入采购单位编号---"
                        v-model="queryList.storeCode"
                        style="width: 180px"
                        @keyup.enter="$refs.mytable.getData()"
                    />&nbsp;
                    <el-input
                        placeholder="---请输入采购单位名称---"
                        v-model="queryList.storeName"
                        style="width: 180px"
                        @keyup.enter="$refs.mytable.getData()"
                    />&nbsp;
                    <el-select
                        placeholder="---请选择状态---"
                        v-model="queryList.status"
                        style="width: 180px"
                    >
                        <el-option label="---请选择---" value />
                        <el-option
                            v-for="item in optionsState"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value"
                        />
                    </el-select>&nbsp;
                    <el-button type="primary" @click="$refs.mytable.getData()">查询</el-button>
                </el-form>
            </el-header>
            <el-foot>
                <scTable
                    ref="mytable"
                    :queryType="'purchase-unity/pages'"
                    :data="listData"
                    :queryList="queryList"
                    :column="columnList"
                    :orderList="OrderList"
                    :sort-orders="['ascending', 'descending']"
                    @selection-change="selectionChange"
                    row-key="storeId"
                    key="storeId"
                    stripe
                    show-summary
                    remoteSummary
					style="height: 450px; min-width: 420"
                >
                    <el-table-column type="selection" width="50"></el-table-column>
                    <el-table-column label="采购单位编码" prop="purchaseUnityCode" width="180" sortable></el-table-column>
                    <el-table-column label="采购单位名称" prop="purchaseUnityName" width="180" sortable show-overflow-tooltip></el-table-column>
                    <el-table-column prop="realName" label="联系人" width="90"></el-table-column>
                    <el-table-column prop="mobile" label="手机号" width="120"></el-table-column>
                    <el-table-column prop="address" label="地址" width="100" show-overflow-tooltip></el-table-column>
                    <el-table-column label="状态" prop="statusDesc"  sortable></el-table-column>
                </scTable>
            </el-foot>
        </el-container>
    </el-container>
</template>

<script>
import publicjs from "@/api/model/publicjs";
export default {
    name: "typelist",
    components: {
        publicjs,
    },
    props: {
        defaultQueryList: { type: Object, default: {} },
    },
    data() {
        return {
            selectionRows: [],
            pkList: ["storeId"],
            attrList: {},
            valueList: {},
            queryList: {},
            result: "", // 运行结果
            props1: {
                checkStrictly: true,
                emitPath: false,
            },
            group: [],
            optionsUomCode: [],
            goodsTypeTree: [],
        };
    },
    methods: {
        //表格选择后回调事件
        selectionChange(selection) {
            this.selectionRows = selection;
        },
        async opBindData() {
            this.queryList = {...this.defaultQueryList, ...this.queryList };
            this.$nextTick(() => {
                this.$refs.mytable.getData();
            });
        },
        async initOptions() {
            try {
                var returnValue = await this.$API.auth.PostProcessApi.post(
                    "base-dictionary/options",
                    { Codes: ["Status"] }
                );
                if (returnValue.status == 200) {
                    this.optionsState = returnValue.response.find(
                        (p) => p.code == "Status"
                    ).optionsDetails;
                } else {
                    this.$message.error("操作失败:" + returnValue.msg);
                }
            } catch (error) {
                this.loading = false;
                return false;
            }
        },
    },
    async mounted() {
        await this.initOptions();
        await this.opBindData();
    },
};
</script>
